import { Application } from 'egg';
export default (app: Application) => {
    const { DataTypes: { STRING, DATE, TEXT, INTEGER,DOUBLE} } = app.Sequelize;
    const Model = app.model.define('user', {
        openId: { //小程序登录ID
            type: STRING(64),
            unique: true    //为true表示唯一
        },

        phoneNumber: { //用户手机
            type: STRING
        },
        code: {
            type: STRING, //用户唯一标识
            unique: true    //为true表示唯一
        },
        points: { //积分数
            type: INTEGER,
        },
        loginTime: { //登录时间
            type: STRING
        },
        signTime: { //签到时间
            type: DATE
        },
        account:{
            type:DOUBLE
        },
        signinDay: { //签到天数
            type: INTEGER
        },
        prePoints: { //预积分
            type: INTEGER
        },
        createdAt: {
            type: DATE,
            allowNull: true,
            field: 'created_at',
            comment: '创建时间',
          },
          updatedAt: {
            type: DATE,
            allowNull: true,
            field: 'updated_at',
            comment: '修改时间',
          },
    },
        {
            comment: '用户表',
            tableName: 'user',
        }
    )
return class UserModel extends Model{
    openId?:string
    phoneNumber?:string
    code?:string
    account?:number
    points?:number
    loginTime?:string
    signTime?:Date
    signinDay?:number
    prePoints?:number

}
}